package demo1102.demo02;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/2 10:04
 */
public class TestShunDown {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 10; i++) {
            final int a=i;
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"="+a);
                }
            });
        }

        executorService.shutdown();
        boolean shutdown = executorService.isShutdown();
        System.out.println(shutdown);
        boolean terminated = executorService.isTerminated();
        System.out.println(terminated);
    }
}
